<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/shopping.css" />
		<link rel="stylesheet" type="text/css" href="css/reset.css" />
	</head>
	<body>
		<header></header>
		<main>
			<!-- 收货信息 -->
			<div id="Receiving">
				<h4>收货信息</h4>
			</div>
			<div class="address">
				<h4>暂无收获地址，请添加</h4>
			</div>
			<div class="Distribution">
				<h4>配送方式</h4>
			</div>
			<div class="Shunfeng">
				<h4>配送方式: 快递</h4>
				<h4>运费: ¥0.00</h4>
				<h4>默认顺丰</h4>
			</div>
			<div class="product">
				<ul>
					<li style="margin-left: 100px;">产品</li>
					<li style="margin-left: 500px;">数量</li>
					<li style="margin-left: 150px;">商品价格</li>
					<li style="margin-left: 150px;">产品名字 </li>
					<li style="margin-left: 150px;">总计</li>
				</ul>
			</div>
			<div class="settlement">
					
			</div>
			<div id="payment">
				<h3>立即支付</h3>
			</div>
		</main>
		
		<footer></footer>
	</body>
</html>
<script src="js/jQuery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	let userName = sessionStorage.getItem("username");
	console.log(userName)
	if (userName == null) {
		alert("请先登录");
		window.location.href = "login.html";
	} else {
		$.ajax({
			type: "get",
			url: "./goodsAndShoppingCart/getShoppingCart.php",
			data: {
				"vipName": userName
			},
			dataType: "json",
			async: false,
			success: function(data) {
				console.log(data);

				for (let i = 0; i < data.length; i++) {
					let ul = $("<ul></ul>");
					let str =
						`
					<li style="margin-left: 100px;"><img src="${data[i].goodsImg}"></li>
					<li style="margin-left: 450px;">${data[i].goodsCount}件</li>
					<li style="margin-left: 90px;">￥${data[i].goodsPrice}</li>
					<li style="margin-left: 90px;">${data[i].goodsName}</li>
					<li style="margin-left: 115px;">￥${data[i].goodsPrice}</li>
				`

					ul.html(str);
					$(".settlement").append(ul)
				}

			},
			error: function() {
				alert("error");
			}

		})
	}

	$("header").load("header.html");
	$("footer").load("footer.html");
</script>
